
var Base = require("../common/base");
var modelHome = require("../../models/home/home");

class Home extends Base{
    constructor(){
        super();
        this.banner = this.banner.bind(this);
        this.catelist = this.catelist.bind(this);
        this.indexNews = this.indexNews.bind(this);
		

        this.msg_success = this.msg_success.bind(this);
		this.msg_err = this.msg_err.bind(this);
		this.msg_insert_success = this.msg_insert_success.bind(this);
    }

	async catelist(req,res,next){
		modelHome.catelist().then(message=>{
			res.send(this.msg_success(message));
		},error=>{
			res.send(this.msg_err(error));
		})
	}

	async banner(req,res,next){
		
        modelHome.banner().then(message=>{
            res.send(this.msg_success(message));
        },error=>{
            res.send(this.msg_err(error));
        })
	}
    
    
    //首页新闻
	async indexNews(req,res,next){
		modelHome.indexNews().then(message=>{
			res.send(this.msg_success(message));
		},error=>{
			res.send(this.msg_err(error));
		})
	}

}

module.exports = new Home();